import { createRouter, createWebHashHistory } from 'vue-router'

// const Home = () => import('@/views/Home.vue')

import Layout from '@/layout/index.vue'

//页面
const Login = () => import('@/views/login/Index.vue')
const PersonalIndex = () => import('@/views/personal/Index.vue')
const PersonalMessage = () => import('@/views/personal/Message.vue')
const AppIndex = () => import('@/views/app/Index.vue')
const NotFound = () => import('@/views/404.vue')
const routes = [
  {
    path: '/',
    name: 'Home',
    component: Layout,
    children: [
      {
        path: 'login',
        name: 'Login',
        component: Login
      },
      {
        path: 'personal',
        name: 'personal',
        component: PersonalIndex,
        children: [
          {
            path: 'message',
            name: 'PersonalMessage',
            component: PersonalMessage
          }
        ]
      },
      {
        path: 'app',
        name: 'App',
        component: AppIndex
      },
      {
        path: '404',
        name: 'NotFound',
        component: NotFound
      }
    ]
  },
  {
    path: '/:pathMatch(.*)*',
    name: '404',
    component: '/404'
  }
]
const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
